<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    .box1 {
      width: 400px;
      height: 400px;
      background-color: silver;
      /* 处理外边距折叠 */
      overflow: hidden;
    }

    .box2 {
      width: 100px;
      height: 100px;
      margin-top: 100px;
      background-color: #bfa;
    }
  </style>
</head>
<body>
  <div class="box1">
    <div class="box2"></div>
  </div>
</body>
</html>